package com.gagakuai.bpm.config.schleTask;


import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

@Slf4j
@Data
@Configuration
public class ScheduleTaskConfig {

    @Value("${cron}")
    private String corn;

    /*
     * 创建定时任务线程池
     */
    @Bean
    public ThreadPoolTaskScheduler threadPoolTaskScheduler(){
        ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
        //设置线程池大小
        threadPoolTaskScheduler.setPoolSize(10);

        //设置线程名称前缀
        threadPoolTaskScheduler.setThreadNamePrefix("hx-bpm-sync-data-task");
        log.info("**********  初始化定时任务线程池  **********");
        return threadPoolTaskScheduler;
    }

//    @Bean
//    public ObjectMapper objectMapper(){
//        ObjectMapper objectMapper = new ObjectMapper();
//        try {
//            BPMUserVo bpmUserVo = objectMapper.readValue(new URL("http://collegewires.com/android/jacksoncw.json"),
//                    new TypeReference<BPMUserVo>(){} );
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        return
//    }
}
